-- @owner: @nanyang12
-- @date: 2025/3/25
-- @testpoint:GMS_XMLGEN.setmaxrows函数传入的查询语句是newcontextfromhierarchy的句柄，合理报错
@conn PrimaryDbAmode;
--前置条件：
drop extension if exists gms_xmlgen cascade;
create extension gms_xmlgen;
drop extension if exists gms_output cascade;
create extension gms_output;
select gms_output.enable(100000);
-- 建表
drop table if exists t_set0004;
create table t_set0004 (c1_integer integer, c2_varchar varchar2(500));
insert into t_set0004 values(generate_series(1,100000),'col&ab"'||generate_series(1,100000));
--step1:GMS_XMLGEN.setmaxrows函数传入的查询语句是newcontextfromhierarchy的句柄，合理报错
DECLARE
xml_output clob;
xml_cxt_from_hierarchy gms_xmlgen.ctxhandle;
BEGIN
xml_cxt_from_hierarchy := gms_xmlgen.newcontextfromhierarchy('
SELECT "integer", xmltype(gms_xmlgen.getxml(''select * from t_set0004''))
FROM t_typesSTART
WITH "integer" = 1 OR "integer" = 2
CONNECT BY nocycle "integer" = PRIOR "integer"');
gms_xmlgen.setmaxrows(xml_cxt_from_hierarchy, 1);
xml_output := gms_xmlgen.getxml(xml_cxt_from_hierarchy);
gms_output.put_line(xml_output);
gms_xmlgen.closecontext(xml_cxt_from_hierarchy);
END;
/
--step2:清理环境
drop table if exists t_set0004;
drop extension if exists gms_xmlgen cascade;
drop extension if exists gms_output cascade;